package MianShi.hash;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wys
 * created in 17:37 2019/3/4
 */
public class String_Hashcode {


    public static class Test1 {

        private String name;

        public Test1(String name) {
            this.name = name;
        }



    }

    public static void main(String args[]) {

        Map<Test1, String> map = new HashMap<>(4);
        Test1 hello1 = new Test1("hello");
        System.out.println(" hello1.hashCode() 1 = " + hello1.hashCode());
        System.out.println(" hello1.hashCode() 2 = "  + new Test1("hello").hashCode());
        System.out.println(" hello1.hashCode() 3 = "  + new Test1("hello").hashCode());
        map.put(new Test1("hello"), "hello");
        String hello = map.get(new Test1("hello"));
        System.out.println("hello = " + hello);
    }

}

